Skip to content

Auto-fixes for jeff/feat/g1_raycast_ivan#2354

Open
paul-nechifor wants to merge 3 commits into
jeff/feat/g1_raycast_ivanfrom
jeff/feat/g1_raycast_ivan-autofixes2
Open

Auto-fixes for jeff/feat/g1_raycast_ivan#2354
paul-nechifor wants to merge 3 commits into
jeff/feat/g1_raycast_ivanfrom
jeff/feat/g1_raycast_ivan-autofixes2

Conversation

@paul-nechifor
Copy link
Copy Markdown
Contributor

@paul-nechifor paul-nechifor commented Jun 4, 2026

These are automated fixes. Each fix is a separate commit. Use git rebase -i to drop any you disagree with.

The color_lookup_table param of OccupancyGrid.to_rerun is a uint8 RGBA
LUT; type it precisely per the repo convention. NDArray is already
imported under TYPE_CHECKING and the file has future annotations.
This was the only blueprint file with a top-level 'import rerun'. Move
it inside _g1_path_colors to match every other blueprint (rerun is a
heavy/optional dep and blueprint imports must have no side effects).
The TF parent used self.frame_id (Module property, applies
frame_id_prefix) while the child used raw self.config.child_frame_id.
With a prefix set, the parent would be namespaced and the child not,
breaking the TF tree. The C++ side emits raw config frame ids in message
headers (via to_cli_args), so derive both from raw config to match.
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 4, 2026

Greptile Summary

This PR applies three automated fixes to the G1 Raycast feature branch, each as a separate commit.

  • fastlio2/module.py: Fixes a runtime AttributeErrorself.frame_id was referenced in _on_odom_for_tf, but FastLio2 has no direct frame_id attribute; the correct path is self.config.frame_id.
  • OccupancyGrid.py: Narrows the color_lookup_table parameter type from the broad np.ndarray to NDArray[np.uint8], matching the actual contract of the LUT (uint8 RGBA values). Safe at runtime because from __future__ import annotations defers annotation evaluation.
  • unitree_g1_vis.py: Makes the rerun import lazy by moving it inside _g1_path_colors, avoiding an unconditional top-level dependency on the rerun package when the function is never called.

Confidence Score: 5/5

All three changes are narrow, mechanical corrections with no new logic introduced.

The frame_id fix corrects a clear attribute access error that would have crashed TF publishing on every odometry message. The other two changes are safe type-annotation tightening and import scoping — neither alters runtime behavior. No new code paths, no API surface changes.

No files require special attention.

Important Files Changed

Filename Overview
dimos/hardware/sensors/lidar/fastlio2/module.py Fixes AttributeError: self.frame_idself.config.frame_id; FastLio2 has no direct frame_id attribute so the original code would raise at runtime
dimos/msgs/nav_msgs/OccupancyGrid.py Tightens color_lookup_table type hint from np.ndarray to NDArray[np.uint8]; safe at runtime because from __future__ import annotations is present and NDArray is already imported under TYPE_CHECKING
dimos/robot/unitree/g1/blueprints/primitive/unitree_g1_vis.py Moves import rerun as rr from module-level to inside _g1_path_colors, making rerun a lazy import; safe because the function is only passed as a callback reference at module level, not called immediately

Sequence Diagram

sequenceDiagram
    participant Odom as Odometry stream
    participant FastLio2
    participant Config as FastLio2Config
    participant TF as tf.publish

    Odom->>FastLio2: _on_odom_for_tf(msg)
    FastLio2->>Config: self.config.frame_id (fixed)
    FastLio2->>Config: self.config.child_frame_id
    FastLio2->>TF: Transform(frame_id, child_frame_id, ...)
Loading

Reviews (2): Last reviewed commit: "fix: derive FastLio2 TF frame ids consis..." | Re-trigger Greptile

Comment on lines +27 to +28
host_ip="192.168.123.164",
lidar_ip="192.168.123.120",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Hardcoded IPs remove environment-level configurability

The previous code read os.getenv("LIDAR_HOST_IP", "192.168.123.164") and os.getenv("LIDAR_IP", "192.168.123.120"), allowing deployments on different networks to override the addresses without touching source. Now host_ip and lidar_ip are literal strings, so any machine whose host or LiDAR lives on a different subnet requires a code change. This is a regression if this blueprint is reused across environments or test benches.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

)

__all__ = ["unitree_g1_vis"]
__all__ = ["_unitree_g1_vis"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Private symbol in __all__ is contradictory

__all__ conventionally lists the module's public API — names that consumers are meant to import. Exporting a leading-underscore name (_unitree_g1_vis) through __all__ sends contradictory signals: the underscore marks it as internal, but __all__ marks it as public. Consider either removing __all__ entirely (since the file is a shared sub-blueprint) or documenting why the name is prefixed yet exported.

Suggested change
__all__ = ["_unitree_g1_vis"]
__all__ = ["_unitree_g1_vis"] # internal sub-blueprint, exported for sibling blueprints

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../g1/blueprints/navigation/unitree_g1_nav_simple.py 0.00% 1 Missing ⚠️
.../unitree/g1/blueprints/primitive/unitree_g1_vis.py 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@paul-nechifor paul-nechifor force-pushed the jeff/feat/g1_raycast_ivan-autofixes2 branch from 340067c to c220b10 Compare June 4, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant